package com.ruoyi.finance.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.finance.domain.Distributionrecord;
import com.ruoyi.finance.domain.DistributorRecordVO;
import com.ruoyi.finance.mapper.DistributionrecordMapper;
import com.ruoyi.finance.service.IDistributionrecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 分销记录表Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-10
 */
@Service
public class DistributionrecordServiceImpl implements IDistributionrecordService 
{
    @Autowired
    private DistributionrecordMapper distributionrecordMapper;

    /**
     * 查询分销记录表
     * 
     * @param distributorId 分销记录表主键
     * @return 分销记录表
     */
    @Override
    public Distributionrecord selectDistributionrecordByDistributorId(Integer distributorId)
    {
        return distributionrecordMapper.selectDistributionrecordByDistributorId(distributorId);
    }

    /**
     * 查询分销记录表列表
     * 
     * @param distributionrecord 分销记录表
     * @return 分销记录表
     */
    @Override
    public List<DistributorRecordVO> selectDistributionrecordList(DistributorRecordVO distributorRecordVO)
    {
        return distributionrecordMapper.selectDistributionrecordList(distributorRecordVO);
    }

    /**
     * 新增分销记录表
     * 
     * @param distributionrecord 分销记录表
     * @return 结果
     */
    @Override
    public int insertDistributionrecord(Distributionrecord distributionrecord)
    {
        distributionrecord.setCreateTime(DateUtils.getNowDate());
        return distributionrecordMapper.insertDistributionrecord(distributionrecord);
    }

    /**
     * 修改分销记录表
     * 
     * @param distributionrecord 分销记录表
     * @return 结果
     */
    @Override
    public int updateDistributionrecord(Distributionrecord distributionrecord)
    {
        return distributionrecordMapper.updateDistributionrecord(distributionrecord);
    }

    /**
     * 批量删除分销记录表
     * 
     * @param distributorIds 需要删除的分销记录表主键
     * @return 结果
     */
    @Override
    public int deleteDistributionrecordByDistributorIds(Integer[] distributorIds)
    {
        return distributionrecordMapper.deleteDistributionrecordByDistributorIds(distributorIds);
    }

    /**
     * 删除分销记录表信息
     * 
     * @param distributorId 分销记录表主键
     * @return 结果
     */
    @Override
    public int deleteDistributionrecordByDistributorId(Integer distributorId)
    {
        return distributionrecordMapper.deleteDistributionrecordByDistributorId(distributorId);
    }
}
